package com.vita.bduck.logger.helps;

import com.vita.bduck.logger.LogConstant;

/**
 * 内部工具类
 * Created with IntelliJ IDEA.
 * User: Vita Hao
 * Date: 13-6-19
 * Time: 上午10:09
 * To change this template use File | Settings | File Templates.
 */
public class Utils {

    private final static String TAG = LogConstant.LOG_TAG;

    static final public void report(String msg, Throwable t) {
        android.util.Log.e(TAG, msg);
        android.util.Log.e(TAG, "Reported exception:");
        t.printStackTrace();
    }

    static final public void report(String msg) {
        android.util.Log.e(TAG, "ERROR : " + msg);
    }

    /**
     * 格式化多个参数
     *
     * @param format
     * @param arg1
     * @param arg2
     */
    public static String format(final String format, final Object arg1, final Object arg2) {
        return MessageFormatter.format(format, arg1, arg2).getMessage();
    }

    /**
     * 格式化参数数组
     *
     * @param format
     * @param args
     */
    public static String format(final String format, final Object[] args) {
        return MessageFormatter.arrayFormat(format, args).getMessage();
    }

}
